package com.vv.config;

import org.apache.catalina.LifecycleException;
import org.apache.catalina.startup.Tomcat;

public class SpringApplication {

    //完成tomcat的创建及启动
    public static void run(){

        Tomcat tomcat = new Tomcat();
        tomcat.setPort(8080);

        try {

            //设置资源文件存放路径（不设置访问不到）
            tomcat.addWebapp("/","F:\\");

            //启动tomcat
            tomcat.start();

            //维持tomcat服务，否则tomcat一启动就会关闭
            tomcat.getServer().await();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
